import type { App, Component } from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import SvgIcon from '@/components/SvgIcon/index.vue'

const globalComponents: { [name: string]: Component } = {
	SvgIcon,
	...ElementPlusIconsVue
}

export default {
	// 插件本质是一个对象，对象中有一个install方法
	install(app: App) {
		Object.keys(globalComponents).forEach(componentName => {
			app.component(componentName, globalComponents[componentName])
		})
	},
}
